import { getUserList } from '@/api/sys'
const sys = {
  state: {
    userList:[],
    totalPage:0
  },
  mutations: {

    GET_USER_LIST: (state, userList) => {
      state.userList = userList.list
      state.totalPage=userList.totalPage
    }
  },
  actions: {
    GetUserList({ commit }, userList) {
      console.log('data1')
      return new Promise((resolve, reject) => {
        getUserList(userList).then(response => {
          // http://192.168.9.105:8888/sys/userList
          // const data = response.data
          // console.log(data)
          // console.log(response)
          console.log('getUserList')
          if(response.data.code==200){
            commit('GET_USER_LIST',response.data.page)
          }

          resolve()
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}

export default sys
